package text;

public class text4 {
    public static void main(String[] args) {
        String str = "I love china";
        int count = 0;
        int i = 1;
        while(str.charAt(str.length() - i++) != ' ') {
            count++;
        }
        System.out.println(count);
    }
}
